package com.supermap.business.cloud.agrinfo;

import com.alibaba.dubbo.config.annotation.Reference;
import com.sun.org.apache.regexp.internal.RE;
import com.supermap.dataservice.util.JSONUtil;
import com.supermap.dubbo.api.cloud.agrinfo.AgrinfoCloudService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * @author aqua
 * @description
 * @date 2018年11月16 上午 10:53
 * @email 1301584033@qq.com
 */
@Controller
@RequestMapping("/cloud/agrinfo")
public class AgrinfoCloudController {

    @Reference(timeout = 100000)
    private AgrinfoCloudService agrinfoCloudService;

    /**
     * 农情分布展示:
     * */
    @GetMapping("/getAgrinfoByareaCodeAndbreed")
    @ResponseBody
    public JSONUtil getAgrinfoByareaCodeAndbreed(String areaCode, String cropBreedId){
      return   agrinfoCloudService.getAgrinfoByareaCodeAndbreed(areaCode,cropBreedId);
    }

    /**
     * 农情详情展示
     * */
    @GetMapping("/getAgrinfoDetailsByUserId")
    @ResponseBody
    public JSONUtil getAgrinfoDetailsByUserId(String userId,Integer pageNum,Integer pageSize){
        return  agrinfoCloudService.getAgrinfoDetailsByUserId(userId,pageNum,pageSize);
    }



    /**
     * 灾情分布展示:
     * */
    @GetMapping("/getDisasterByareaCodeAndbreed")
    @ResponseBody
    public JSONUtil getDisasterByareaCodeAndbreed(String areaCode, String cropBreedId,String disatype){
        return   agrinfoCloudService.getDisasterByareaCodeAndbreed(areaCode,cropBreedId,disatype);
    }

    /**
     * 农情详情展示
     * */
    @GetMapping("/getDisasterDetailsByUserId")
    @ResponseBody
    public JSONUtil getDisasterDetailsByUserId(String userId,Integer pageNum,Integer pageSize){
        return  agrinfoCloudService.getDisasterDetailsByUserId(userId,pageNum,pageSize);
    }

    /**
     * 农事分布展示:
     * */
    @GetMapping("/getFarmingByareaCodeAndbreed")
    @ResponseBody
    public JSONUtil getDisasterByareaCodeAndbreed(String areaCode, String cropBreedId){
        return   agrinfoCloudService.getFarmingByareaCodeAndbreed(areaCode,cropBreedId);
    }

    /**
     * 农事详情展示
     * */
    @GetMapping("/getFarmingDetailsByFarmId")
    @ResponseBody
    public JSONUtil getFarmingDetailsByFarmId(String farmId,Integer pageNum,Integer pageSize){
        return  agrinfoCloudService.getFarmingDetailsByFarmId(farmId,pageNum,pageSize);
    }

    /**
     * 获取区域内的上报信息(农情、灾情、咨询、农事活动)
     * */
    @GetMapping("/getInfoByAreaCode")
    @ResponseBody
    public JSONUtil getInfoByAreaCode(String areaCode,Integer pageNum,Integer pageSize){
        return  agrinfoCloudService.getInfoByAreaCode(areaCode,pageNum,pageSize);
    }

}
